<style>
  div {
    width: 190px;
    height: 190px;
    background: #ddd;
    position: relative;
  }

  div:before,
  div:after {
    position: absolute;
    content: "";
    left: -5px;
    right: -5px;
    top: -5px;
    bottom: -5px;
    border: 5px solid #ffae0088;
  }

  div:before {
    animation: move 5s linear infinite;
  }

  div:after {
    border-color: #00ff40d5;
    animation: move 5s linear infinite -2.5s;
  }

  @keyframes move {
    0%,
    100% {
      clip: rect(0, 200px, 5px, 0);
    }

    25% {
      clip: rect(0, 200px, 200px, 195px);
    }

    50% {
      /* border-color: #00ff0088; */
      clip: rect(195px, 200px, 200px, 0);
    }

    75% {
      clip: rect(0, 5px, 200px, 0px);
    }
  }
</style>
<div></div>